﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace WcfContrib.Client
{
    /// <summary>
    /// Represents a channel exception details
    /// </summary>
    public class ChannelExceptionEventArgs : EventArgs
    {
        /// <summary>
        /// Gets the exception.
        /// </summary>
        /// <value>The exception.</value>
        public Exception Exception { get; private set; }
        /// <summary>
        /// Gets the invocation context.
        /// </summary>
        /// <value>The invoke context.</value>
        public ChannelInvokeContext InvokeContext { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelExceptionEventArgs"/> class.
        /// </summary>
        /// <param name="instanceType">Type of the client instance.</param>
        /// <param name="contractType">Type of the contract.</param>
        /// <param name="method">The method that yielded the exception.</param>
        /// <param name="exception">The exception.</param>
        /// <param name="parameters">The parameter values sent to the method.</param>
        public ChannelExceptionEventArgs(Type instanceType, Type contractType, MethodBase method, Exception exception, object[] parameters)
        {
            InvokeContext = new ChannelInvokeContext(instanceType, contractType, method, parameters);

            Exception = exception;
        }
    }
}
